import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/home'//精确到文件夹即可，系统自动查找文件夹下的index.vue文件



Vue.use(VueRouter)

const routes = [

  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/tellgen',
    component: () => import('@/views/tellgen'), //index页面
    name: 'tellgen',
    meta: {
      title: 'tellgen-透景'
    },
    children: [{
        path: '',
        redirect: 'home',
      },
      {
        path: 'datacenter',
        component: () => import('@/components/DataCenter/dataCenter'),
        name: 'datacenter',
        meta: {
          title: 'tellgen透景-数据中心'
        },
        children: [{
            path: '',
            redirect: 'reagentquire'
          },
          {
            path: 'reagentquire',
            component: () => import('@/components/DataCenter/DataQuire/reagent-inquire'),
            name: 'reagentquire',
            meta: { //元数据
              title: 'tellgen透景-试剂查询'
            }
          },
          {
            path: 'maintainquire',
            component: () => import('@/components/DataCenter/DataQuire/maintain-inquire'),
            name: 'maintainquire',
            meta: {
              title: 'tellgen透景-维护查询'
            }
          },
          {
            path: 'faultquire',
            component: () => import('@/components/DataCenter/DataQuire/fault-inquire'),
            name: 'faultquire',
            meta: { //源文件
              title: 'tellgen透景-故障查询'
            }
          },
          {
            path: 'instrumentstates',
            component: () => import('@/components/DataCenter/DataQuire/instrument-states'),
            name: 'instrumentstates',
            meta: { //源文件
              title: 'tellgen透景-仪器状态'
            }
          },
          {
            path: 'usersetting',
            component: () => import('@/components/DataCenter/SetPages/user-setting'),
            name: 'usersetting',
            meta: {
              title: 'tellgen-用户设置'
            }
          },
          {
            path: 'instrumentsetting',
            component: () => import('@/components/DataCenter/SetPages/instrument-setting'),
            name: 'instrumentsetting',
            meta: {
              title: 'tellgen-仪器设置'
            }
          },
          {
            path: 'regionsetting',
            component: () => import('@/components/DataCenter/SetPages/region-setting'),
            name: 'regionsetting',
            meta: {
              title: 'tellgen-大区设置'
            }
          },
          {
            path: 'hospitalsetting',
            component: () => import('@/components/DataCenter/SetPages/hospital-setting'),
            name: 'hospitalsetting',
            meta: {
              title: 'tellgen-大区设置'
            }
          },
          {
            path: 'faultsetting',
            component: () => import('@/components/DataCenter/SetPages/fault-setting'),
            name: 'faultsetting',
            meta: {
              title: 'tellgen-故障设置'
            }
          },
          {
            path: 'instrumenttype',
            component: () => import('@/components/DataCenter/SetPages/instrument-type'),
            name: 'instrumenttype',
            meta: {
              title: 'tellgen-仪器类型'
            }
          },
        ]
      },
      {
        path: 'home',
        component: () => import('@/components/Home'),
        name: 'home',
        meta: {
          title: 'tellgen透景-首页'
        }
      },
      {
        path: 'maintain',
        component: () => import('@/components/Maintain'),
        name: 'maintain',
        meta: {
          title: 'tellgen透景-维护'
        }
      },
      {
        path: 'fault',
        component: () => import('@/components/Fault'),
        name: 'fault',
        meta: {
          title: 'tellgen透景-故障'
        }
      },
      {
        path: 'reagent',
        component: () => import('@/components/Reagent'),
        name: 'reagent',
        meta: {
          title: 'tellgen透景-试剂'
        }
      },
      {
        path: 'instrument',
        component: () => import('@/components/Instrument'),
        name: 'instrument',
        meta: {
          title: 'tellgen透景-仪器'
        }
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/tellgen/login'),
    meta: {
      title: 'tellgen透景-登录页'
    }
  },
  {
    path: '/changepassword/:users',//动态路由写法，在页面中跳转路由时可以携带参数，在目标页面this.$route.params.users即可
    component: () => import('@/views/tellgen/changePassWord'),
    meta: {
      title: 'tellgen透景-密码设置'
    }
  },

]
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
});
router.beforeEach((to, from, next) => {
  document.title = to.meta.title;
  next();
});

export default router